package com.ruoyi.teaching.service.impl;

import com.ruoyi.common.security.utils.SecurityUtils;
import com.ruoyi.system.api.domain.SysUser;
import com.ruoyi.teaching.domain.*;
import com.ruoyi.teaching.mapper.TeachingOverviewMapper;
import com.ruoyi.teaching.mapper.YaStudentMapper;
import com.ruoyi.teaching.service.TeachingOverviewService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
@Service
public class TeachingOverviewServiceImpl implements TeachingOverviewService {
    @Autowired
    private TeachingOverviewMapper teachingOverviewMapper;
    @Autowired
    private YaStudentMapper yaStudentMapper;
    @Override
    public List<YaAttendance> getWeekAttendance() {
        SysUser user = SecurityUtils.getLoginUser().getSysUser();
        return teachingOverviewMapper.getWeekAttendance(user.getUserId());
    }

    @Override
    public List<YaInterviewMasteryDetail> getInterviewStatus() {
        SysUser user = SecurityUtils.getLoginUser().getSysUser();
        return teachingOverviewMapper.getInterviewStatus(user.getUserId());
    }

    @Override
    public List<YaAttendanceStatistics> getTodayAttendance() {
        SysUser user = SecurityUtils.getLoginUser().getSysUser();
        YaStudent yaStudent = yaStudentMapper.selectById(user.getUserId());
        String classesName = yaStudent.getClassesName();
        return teachingOverviewMapper.getTodayAttendance(classesName);
    }

    @Override
    public List<YaDailyTasks> getYesterdayTasks() {
        SysUser user = SecurityUtils.getLoginUser().getSysUser();
        YaStudent yaStudent = yaStudentMapper.selectById(user.getUserId());
        Long classesId = yaStudent.getClassesId();
        return teachingOverviewMapper.getYesterdayTasks(classesId);
    }

    @Override
    public List<YaDailyTasks> getWeekTasks() {
        SysUser user = SecurityUtils.getLoginUser().getSysUser();
        return teachingOverviewMapper.getWeekTasks(user.getUserId());
    }


}
